package com.mao.model.warehouse;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.apache.struts2.json.annotations.JSON;

import com.mao.model.BaseModel;

@Entity
@Table(name = "MAO_WAREHOUSE")
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
public class WareHouse extends BaseModel{
	
	private static final long serialVersionUID = 1L;

	private Long id;
	
	private String name;
	
	private String no; // 仓库自定义编码
	
	private String note; // 备注
	
	private WareHouseClass wc;
	
	@Id
	@GeneratedValue
	@Column(name = "ID")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "NAME")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	

	@Column(name = "NOTE", columnDefinition = "TEXT")
	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}
	
	@ManyToOne(optional = true, fetch = FetchType.LAZY)
	@JoinColumn(name = "WAREHOUSECLASS", nullable = false, columnDefinition = "int")
	@JSON(serialize = false)
	public WareHouseClass getWc() {
		return wc;
	}

	public void setWc(WareHouseClass wc) {
		this.wc = wc;
	}
	
	@Column(name = "NO")
	public String getNo() {
		return no;
	}

	public void setNo(String no) {
		this.no = no;
	}

}
